home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
miscellaneous
/
example1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
8KB
|
284 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) Amiga C Club (ACC) */
/* -------------------------- ------------------ */
/* */
/* Manual: AmigaDOS Amiga C Club */
/* Chapter: Miscellaneous Tulevagen 22 */
/* File: Example1.c 181 41 LIDINGO */
/* Author: Anders Bjerin SWEDEN */
/* Date: 93-09-26 */
/* Version: 1.2 */
/* */
/* Copyright 1993, Anders Bjerin - Amiga C Club (ACC) */
/* */
/* Registered members may use this program freely in their */
/* own commercial/noncommercial programs/articles. */
/* */
/***********************************************************/
/* This example demonstrates how to use the IoErr() function. */
/* It contains a simple but rather useful function which will */
/* try to give the user some more information about the last */
/* dos error. Good for debugging! */
/* Include the dos library definitions: */
#include <dos/dos.h>
/* Now we include the necessary function prototype files: */
#include <clib/dos_protos.h> /* General dos functions... */
#include <clib/exec_protos.h> /* System functions... */
#include <stdio.h> /* Std functions [printf()...] */
#include <stdlib.h> /* Std functions [exit()...] */
/* Set name and version number: */
UBYTE *version = "$VER: AmigaDOS/Miscellaneous/Example1 1.2";
/* Declared our own functions: */
/* Our main function: */
int main( int argc, char *argv[] );
/* Prints some information about the error: */
void explain_error( void );
/* Main function: */
int main( int argc, char *argv[] )
{
/* Well, this example does not do very much for the moment. */
/* However, you can copy the function "explain_error()" into */
/* your own programs for debugging. */
printf( "May the bugs be few...\n" );
/* The End! */
exit( 0 );
}
/* This function will collect the global error code and */
/* print some information about the last dos error: */
void explain_error( void )
{
/* Store the error value here: */
LONG error_code;
/* Collect the global error code: */
error_code = IoErr();
/* Print the error code: */
printf( "Error code: %d - ", error_code );
/* Examine the error code: */
switch( error_code )
{
case ERROR_NO_FREE_STORE:
printf( "Out of memory!\n" );
break;
case ERROR_TASK_TABLE_FULL:
printf( "To many processes running!\n" );
break;
case ERROR_BAD_TEMPLATE:
printf( "Incorrect command line template!\n" );
break;
case ERROR_BAD_NUMBER:
printf( "Incorrect number/value!\n" );
break;
case ERROR_REQUIRED_ARG_MISSING:
printf( "Required arguemnt was not set!\n" );
break;
case ERROR_KEY_NEEDS_ARG:
printf( "The argument after the keyword is missing!\n" );
break;
case ERROR_TOO_MANY_ARGS:
printf( "Too many arguments on the command line!\n" );
break;
case ERROR_UNMATCHED_QUOTES:
printf( "Incorrect number of quotations!\n" );
break;
case ERROR_LINE_TOO_LONG:
printf( "Too long command line!\n" );
break;
case ERROR_FILE_NOT_OBJECT:
printf( "The file can not be found and/or executed\n" );
break;
case ERROR_INVALID_RESIDENT_LIBRARY:
printf( "The AmigaDOS library is too old!\n" );
break;
case ERROR_NO_DEFAULT_DIR:
printf( "There does not exist a default directory!\n" );
break;
case ERROR_OBJECT_IN_USE:
printf( "The object is currently used and is locked!\n" );
break;
case ERROR_OBJECT_EXISTS:
printf( "The object already exist and can not be deleted!\n" );
break;
case ERROR_DIR_NOT_FOUND:
printf( "Unknown directory!\n" );
break;
case ERROR_OBJECT_NOT_FOUND:
printf( "Unknown file or device!\n" );
break;
case ERROR_BAD_STREAM_NAME:
printf( "The string contained invalid commands/parameters!\n" );
break;
case ERROR_OBJECT_TOO_LARGE:
printf( "The object is too big!\n" );
break;
case ERROR_ACTION_NOT_KNOWN:
printf( "Impossible command used on a device!\n" );
break;
case ERROR_INVALID_COMPONENT_NAME:
printf( "Too long name or invalid signs used!\n" );
break;
case ERROR_INVALID_LOCK:
printf( "Invalid type of lock used!\n" );
break;
case ERROR_OBJECT_WRONG_TYPE:
printf( "Incorrect object type used!\n" );
break;
case ERROR_DISK_NOT_VALIDATED:
printf( "The disk has not yet been validated or is damaged!\n" );
break;
case ERROR_DISK_WRITE_PROTECTED:
printf( "The disk is write protected!\n" );
break;
case ERROR_RENAME_ACROSS_DEVICES:
printf( "Can not rename an object to another device!\n" );
break;
case ERROR_DIRECTORY_NOT_EMPTY:
printf( "Can not delete the directory since it is not empty!\n" );
break;
case ERROR_TOO_MANY_LEVELS:
printf( "Too many soft links used!\n" );
break;
case ERROR_DEVICE_NOT_MOUNTED:
printf( "Device not available!\n" );
break;
case ERROR_SEEK_ERROR:
printf( "Tried to move the file cursor outside the file!\n" );
break;
case ERROR_COMMENT_TOO_BIG:
printf( "Too long comment used!\n" );
break;
case ERROR_DISK_FULL:
printf( "The disk is full!\n" );
break;
case ERROR_DELETE_PROTECTED:
printf( "The object is protected from being deleted!\n" );
break;
case ERROR_WRITE_PROTECTED:
printf( "The object is protected from being overwritten\n" );
break;
case ERROR_READ_PROTECTED:
printf( "The object is protected from being read!\n" );
break;
case ERROR_NOT_A_DOS_DISK:
printf( "The disk is not of AmigaDOS format!\n" );
break;
case ERROR_NO_DISK:
printf( "No disk in the drive!\n" );
break;
case ERROR_NO_MORE_ENTRIES:
printf( "No more objects in the directory!\n" );
break;
case ERROR_IS_SOFT_LINK:
printf( "Can not do it on a soft link!\n" );
break;
case ERROR_OBJECT_LINKED:
printf( "The object is linked!\n" );
break;
case ERROR_BAD_HUNK:
printf( "Incorect hunk found!\n" );
break;
case ERROR_NOT_IMPLEMENTED:
printf( "The feature has not been implemented yet!\n" );
break;
case ERROR_RECORD_NOT_LOCKED:
printf( "The record was not locked!\n" );
break;
case ERROR_LOCK_COLLISION:
printf( "Two locks collided!\n" );
break;
case ERROR_LOCK_TIMEOUT:
printf( "The time to get the lock has expired!\n" );
break;
case ERROR_UNLOCK_ERROR:
printf( "Problems with unlocking the object!\n" );
break;
case ERROR_BUFFER_OVERFLOW:
printf( "Some internal buffer was too small!\n" );
break;
case ERROR_BREAK:
printf( "The executin was stopped!\n" );
break;
case ERROR_NOT_EXECUTABLE:
printf( "The file is protected from being executed!\n" );
break;
default:
printf( "Unknown error reported!\n" );
}
}